//1. set this to the desired path
cd "~/Desktop/LAP_PSRM_Replication/"

//2. Import the Garlick (2017) replication data  with the additional roll call votes from main analysis
use "LAP_Replication_COOHWIUS.dta", clear

//3. Find passage votes 
gen voted = 0 
replace voted = 1 if sg_v == 2 

//4. Make each bill into a line
collapse (max) voted, by( bill_id session state)


//5. Find the numerator (voted bills) and denominator (total bills) per session.
gen total = 1
collapse (sum) voted total, by(session state)

//6. Choose which sessions to put in the graph
gen graph = 1
local bads "2012A 2011A 2017A 2018A"
foreach b of local bads{
replace graph = 0 if  session == "`b'"
}

forvalues c = 106/109{
replace graph = 0 if session == "`c'"
}
replace graph = 0 if session == "2015 Regular Session"


//7. Fix the graph labels
replace session = session + "th" if state == "us" | state == "oh"
replace session = subinstr(session,"Regular Session","Reg.",.)
sort state sess

//8. Calculate the bills being voted on
gen notvoted = total-voted

//9. Set the labels
replace state = "Colorado" if state == "co"
replace state = "Ohio" if state == "oh"
replace state = "Wisconsin" if state == "wi"
replace state = "U.S. Congress" if state == "us"


//10. Figure 1
	graph hbar (sum) voted notvoted if graph == 1, perc over(session) by(state, note("")) ///
	stack nofill legend(order(1 "Had passage vote" 2 "No passage vote"))  ytitle(Share of regular bills receiving a passage vote) ///
	blabel(bar, position(center) format(%9.0f))
